package states.gameplay.animations;

import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;

import states.gameplay.Game;
import states.gameplay.Position;

public class LasorAttackAnimation extends AttackAnimation{
	
	private int ttl;
	
	public LasorAttackAnimation(Position startPosition, Position endPosition){
		super(startPosition, endPosition, 0);
		
		ttl = 100;
	}
	
	public void update(int delta){
		ttl -= delta;
		
		if(ttl < 0){
			this.setOver(true);
		}
	}
	
	public void render(Graphics g){
		
		Color oldColor = g.getColor();
		float width = g.getLineWidth();
		
		g.setColor(Color.red);
		g.setLineWidth(3.0f);
		
		
		g.drawLine(startPos.x*Game.CELL_SIZE+10, startPos.y*Game.CELL_SIZE+24+10, endPos.x*Game.CELL_SIZE+10, endPos.y*Game.CELL_SIZE+24+10);
		
		g.setColor(oldColor);
		g.setLineWidth(width);
	}
}
